package com.itheima.array;


import java.util.ArrayList;
import java.util.Scanner;

public class fangdong {
    public static void main(String[] args) {


        ArrayList<Student> list = new ArrayList<>();
        Student stu1 = getstory();
        Student stu2 = getstory();
        Student stu3 = getstory();
        list.add(stu1);
        list.add(stu2);
        list.add(stu3);
        for (int i = 0; i < list.size(); i++) {
            Student stu = list.get(i);
            System.out.println(stu.getName() + "今年" + stu.getAge());
        }
    }

    private static Student getstory() {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入女主姓名：");
        String name = sc.next();
        System.out.println("请输入女主年龄:");
        int age = sc.nextInt();
        Student stu = new Student(name, age);
        return stu;
    }
}